<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/2/16
  Time: 18:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="java.util.List" %>
<%@ page import="com.zhiyou.model.House" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>公寓系统 - 租户信息管理</title>
    <link rel="stylesheet" href="../../css/main.css">
    <link rel="stylesheet" href="../../lib/font-awesome/css/font-awesome.css">
</head>
<body>
<div class="box">
    <h3>租户信息</h3>
    <div class="actions">
        <div>
            <c:forEach items="${auths}" var="auth">
                <c:if test="${auth.aid==2}">
                    <a class="btn btn-primary" href="add.jsp">添加租户</a>
                </c:if>
            </c:forEach>
        </div>
    </div>
    &nbsp;
    <%--模糊查询--%>
    <form action="<c:url value="/user/lessee"/>" method="get">
        姓名 <input type="text" placeholder="请输入姓名" name="keyword">
        <input type="hidden" name="pageNo" value="1" >
        <input type="submit" value="搜索">
    </form>
    <table class="list">
        <tr>
            <th>序号</th>
            <th>姓名</th>
            <th>电话号码</th>
            <th>性别</th>
            <th>np</th>
            <th>身份证</th>
            <th>添加时间</th>
            <th>操作</th>
        </tr>
        <c:forEach items="${lessees}" var="lessee">
            <tr>
                <td>${lessee.lid}</td>
                <td>${lessee.lname}</td>
                <td>${lessee.ltel}</td>
                <td>${lessee.lsex}</td>
                <td>${lessee.lnp}</td>
                <td>${lessee.lidCard}</td>
                <td>${lessee.laddTime}</td>

                <td>
                    <a class="fa fa-info" title="详情" href="<c:url value="/user/lesseeUpdate?lid=${lessee.lid}&detail=1"/>"></a>
                    &nbsp;&nbsp;
                    <c:forEach items="${auths}" var="auth">
                        <c:if test="${auth.aid==3}">
                            <a class="fa fa-pencil" title="编辑" href="<c:url value="/user/lesseeUpdate?lid=${lessee.lid}"/>"></a>
                        </c:if>
                    </c:forEach>
                    &nbsp;&nbsp;
                    <c:forEach items="${auths}" var="auth">
                        <c:if test="${auth.aid==4}">
                            <a class="fa fa-remove" title="删除"  onclick="confirmDelete(${lessee.lid})"></a>
                        </c:if>
                    </c:forEach>
                </td>
            </tr>
        </c:forEach>

        </tr>
    </table>
    <div class="pager-info">
        <div>共有 ${pageUtil.total}条记录，第 ${pageUtil.pageNo}/${pageUtil.pageNum} 页 </div>
        <div>
            <ul class="pagination">
                <li class="paginate_button previous">
                    <a class="${pageUtil.pageNo==1?"disabled":""}" href="<c:url value="/user/lessee?pageNo=${pageUtil.pageNo-1}&keyword=${keywordMap.keyword}"/>">上一页</a>
                </li>
                <c:forEach begin="1" end="${pageUtil.pageNum}" var="i">
                    <li class="paginate_button ${pageUtil.pageNo==i?"active":""}"><a href="<c:url value="/user/lessee?pageNo=${i}&keyword=${keywordMap.keyword}"/>">${i}</a></li>
                </c:forEach>
                <li class="paginate_button next">
                    <a class="${pageUtil.pageNo==pageUtil.pageNum?"disabled":""}" href="<c:url value="/user/lessee?pageNo=${pageUtil.pageNo+1}&keyword=${keywordMap.keyword}"/>">下一页</a>
                </li>
            </ul>
        </div>
    </div>
</div>
<script src="../../lib/jquery/jquery.js"></script>
<script>
    function confirmDelete(id){
        if (confirm("确定要删除吗？")) {
            window.location="<c:url value="/user/lesseeDelete?lid="/>"+id+"&pageNo="+${pageUtil.pageNo};
        }
        return false;
    }
</script>
</body>
</html>